package com.gupaoedu.springframework.demo.controller;

import com.gupaoedu.springframework.demo.service.DemoService;
import com.gupaoedu.springframework.mvcframework.annotation.MyAutowired;
import com.gupaoedu.springframework.mvcframework.annotation.MyController;
import com.gupaoedu.springframework.mvcframework.annotation.MyRequestMapping;
import com.gupaoedu.springframework.mvcframework.annotation.MyRequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * projectName: my-springframwork
 * packageName: com.gupaoedu.springframework.demo.controller
 * Created: 2019/3/27.
 * Auther: baifc
 * Description:
 */
@MyController
@MyRequestMapping("/demo")
public class DemoController {

    @MyAutowired
    private DemoService demoService;

    @MyRequestMapping("/query")
    public void query(HttpServletRequest request, HttpServletResponse response, @MyRequestParam("name") String name) {
        try {
            demoService.query();
            response.getWriter().write("My name is " + name);
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
